package pattern.behavioral.command.simple;

/**
 * @author: chaoyang.ren  
 * @date:Jun 9, 2017  
 * @time:11:20:17 AM   
 * @email:chaoyang.ren@foxmail.com  
 * @version: 1.0
 */
public class RemoteControl {
	private Command[] commands;
	
	public RemoteControl(){
		Command blankButton = new Command() {
			public void execute() {
			}
			public void cancel() {
			}
		};
		commands = new Command[8];
		for (int i = 0; i < 8; i++) {
			commands[i] = blankButton;
		}
	}
	
	public void command(int slot){
		commands[slot].execute();
	}

	public void setCommand(int slot, Command command){
		commands[slot] = command;
	}
}

